package base_object;

import java.awt.Graphics;
import java.awt.Rectangle;
import java.util.Comparator;

import map.Map;


public abstract class ABaseObject implements Comparable<ABaseObject>{
	Map map;
	protected Rectangle rect;
	protected int _x;
	protected int _y; 
	protected int _size = 12;
	protected boolean toKill = false;
	private int _priority = 1;
	public abstract void draw(Graphics g);
	
	public ABaseObject(Map map) {
		this.map = map;
	}
	
	public Rectangle getRectangle() {
		return rect;
	}
	
	public boolean toKill() {
		return toKill;
	}
	
	public boolean intersects(Rectangle rect) {
		if(rect!=null)
			return this.rect.intersects(rect);
		return false;
	}
	
	public void setSize(int value) {
		_size = value;
	}
	
	@Override
	public int compareTo(ABaseObject o) {
		if(this.getPriority()<o.getPriority())
			return -1;
		else if(this.getPriority()>o.getPriority())
			return 1;
		else if(this.getPriority()==o.getPriority())
			return 0;
		return 0;
	}

	public int getPriority() {
		return _priority;
	}

	public void setPriority(int _priority) {
		this._priority = _priority;
	}
	
}
